<?php if (!defined("_ECRIRE_INC_VERSION")) return;

/**
 *  Dymanic Tag wich find and outputs search results
 *  Format: #PDK_RECHERCHE
 */
 
require_once(_DIR_PLUGIN_PDK.'classes/PdkRechercher.php');

function balise_PDK_RECHERCHE($p) {	
	return calculer_balise_dynamique($p,'PDK_RECHERCHE', array());
}

function balise_PDK_RECHERCHE_stat($args, $filtres) {    
	return $args;
}

function balise_PDK_RECHERCHE_dyn() {  
    
    $rechercher = new PdkRechercher();
    
    // Articles
    $where = array();
    $where[] = "statut='publie'";    
    $articles_ids = $rechercher->GetSearchIDs(_request('recherche'), 'articles', 'id_article',false, $where);
    
    // Rubriques
    $where = array();    
    $where[] = "statut='publie'";
    $rubriques_ids = $rechercher->GetSearchIDs(_request('recherche'), 'rubriques', 'id_rubrique',false, $where);    
        
    return array('balise/pdk_recherche', 0, 
		array('articles_ids' => $articles_ids,
              'rubriques_ids' => $rubriques_ids            
		));
}

?>